#ifndef __MOTOR_H__
#define __MOTOR_H__

#include "bsp_GPIO.h"
#include "Bsp_PWM.h"
#include "bsp_timer.h"
#include "bsp_EXTI.h"
#include "bsp_USART.h"
#include "pid.h"



//电机接口
#define MOTORA_IN1  GPIO_Pin_2
#define MOTORA_IN2  GPIO_Pin_3
#define MOTORB_IN1  GPIO_Pin_1
#define MOTORB_IN2  GPIO_Pin_0

//霍尔接口
#define MOTORB_EA   GPIO_Pin_6 
#define MOTORB_EB   GPIO_Pin_7

//电机状态标志
#define F_MOVE 1
#define B_MOVE 2


static long int distance[4];						//霍尔计数



void Motor_Init(void);
void Motor_move(u8 num,u32 speed,u8 move_flag);
long int Read_Speed(u8 num);
void Motor_PID_compute(PID_Handle*Motor_PID, int Target,long int read_speed);
void Motor_target(u8 num ,u8 Target);
float_p Motor_PID_Out(u8 temp,u8 Move_flag);
void Motor_PID_Move(u8 num,int Target);


#endif
